package com.google.appengine.a4ieve.servlets.resources;

import com.google.appengine.a4ieve.AchievementClass;
import com.google.appengine.a4ieve.AchievementType;
import org.json.JSONArray;
import org.json.JSONObject;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.logging.Logger;

/**
 * User: lunin
 * Date: 4/24/14
 * Time: 10:20 AM
 */
public class GetAchievementTypeServant implements Servant {

    private static final Logger LOG = Logger.getLogger(GetAchievementTypeServant.class.getName());
//    private static final String CLASSES = "classes";
//    private static final String TYPES = "types";

    @Override
    public void process(HttpServletRequest req, HttpServletResponse resp) {
        try {
            JSONArray output = new JSONArray();
//            JSONObject classes = new JSONObject();
//            classes.put(CLASSES, AchievementClass.getRepresentation());
//            JSONObject types = new JSONObject();
//            types.put(TYPES, AchievementType.getRepresentation());
            output.put(AchievementClass.getRepresentation());
            output.put(AchievementType.getRepresentation());
            output.write(resp.getWriter());
        } catch (IOException e) {
            LOG.severe("Error writing achievement class" + e);
        }
    }
}
